### COX
```{r, warning=FALSE}
# Load required libraries
library(readxl)
library(ggplot2)
library(dplyr)
library(extrafont)  # For font control

# Import Times New Roman font (run this once)
# font_import()
# loadfonts(device = "win")  # For Windows
# loadfonts(device = "pdf")  # For PDF output

# Read the Excel file with your specific path
data <- read_excel("D:/堉文师姐/RDN/曹总_RDN_Data/Output/MLDF/LSSVM/Direct/MCUVE/LSSVM_all_predictions.xlsx")

# Filter the data for COX
variable_data <- data %>% 
  filter(Variable == "COX")

# Create the plot with improved annotation
prediction_plot <- ggplot(variable_data, aes(x = Actual, y = Predicted)) +
  # Blue dots with transparency
  geom_point(color = "blue", size = 4, alpha = 0.7) +  
  # Thicker red dashed 1:1 line
  geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red", size = 3) +
  labs(
    title = "COX",
    x = "Actual",
    y = "Predicted"
  ) +
  # Better positioned annotation box with your values
  annotate(
    "label", 
    x = min(variable_data$Actual) + 0.8 * (max(variable_data$Actual) - min(variable_data$Actual)),
    y = min(variable_data$Predicted) + 0.13 * (max(variable_data$Predicted) - min(variable_data$Predicted)),
    label = "R² = 0.97770\nsMAPE = 4.5091%",
    size = 12,
    family = "Times New Roman",
    fontface = "bold",
    label.padding = unit(1, "lines"),
    label.size = 0,  # Remove the border
    fill = "NA"
  ) +
  theme_bw() +
  theme(
    text = element_text(family = "Times New Roman", face = "bold", color = "black"),
    panel.grid = element_blank(),
    axis.line = element_line(color = "black"),
    panel.border = element_rect(color = "black", fill = NA, size = 4),
    axis.title = element_text(size = 36, family = "Times New Roman", face = "bold", color = "black"),
    axis.text = element_text(size = 32, family = "Times New Roman", face = "bold", color = "black"),
    title = element_text(size = 34, family = "Times New Roman", face = "bold", color = "black"),
    legend.title = element_text(size = 40, family = "Times New Roman", face = "bold", color = "black"),
    legend.text = element_text(size = 40, family = "Times New Roman", face = "bold", color = "black")
  )


print(prediction_plot)


ggsave("D:/堉文师姐/RDN/曹总_RDN_Data/Output/Visualizations/Residual Plots/COX.png", prediction_plot, width = 10, height = 8, dpi = 300)
```